package com.bosicloud.cmb.ibp.commom.utils;

import com.alibaba.fastjson.JSONObject;

import java.util.Enumeration;
import java.util.Properties;

/**
 * @author Jack Peng / ziliang.peng@bosicloud.com
 */
@SuppressWarnings("ALL")
public class PropertiesUtils {

    public static String properties2jsonString(Properties properties) {

        JSONObject obj = new JSONObject();

        Enumeration<Object> keys = properties.keys();
        while (keys.hasMoreElements()) {
            String key = keys.nextElement().toString();
            obj.put(key, properties.get(key));
        }

        return obj.toJSONString();
    }

}
